﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using FarseerPhysics.Dynamics;
using JumpAndRun.Factory;

namespace JumpAndRun.Map
{
	public class TileMap
	{
		private TileLayer[] layers;
		private Texture2D[] textures;

		private World world;
		public World World
		{
			get
			{
				if (world == null)
					world = PhysicsFactory.CreateWorld();

				return world;
			}
			private set { world = value; }
		}

		private TileMap() { }

		public void Update(GameTime gt)
		{
			world.Step(1f / 30f);
		}

		public void Draw(SpriteBatch sb)
		{
			for (byte i = 0; i < this.layers.Length; i++)
			{
				this.layers[i].Draw(sb, this.textures);
			}
		}

		public static TileMap CreateFromFile(ContentManager content, string path)
		{
			throw new NotImplementedException();
		}
	}
}
